<?php
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

$eventTable = new BAEventSheet();
$event = $eventTable->getListById($eventId);
$pollTable = new BWWePollSheet('wePoll', $event);

$pollView = $pollTable->getView();
?>
<table class="table table-hover">
    <thead>
        <tr>
            <th><input type="checkbox" name="checkAll_2" id="checkAll_2"></th>
            <th>投票名称</th>
            <th>内容描述</th>
            <th>操作</th>
        </tr> 
    </thead>
    <tbody>
        <?php foreach ($pollView as $pollId => $poll) { ?>
            <tr>
                <td><label class="checkbox">
                        <input type="checkbox" name="subBox[]" value="<?php echo $poll->id; ?>"> 
                    </label></td>
                <td> <?php echo $poll->getItem('name')->getValue(); ?> </td>              
                <td> <?php echo $poll->getItem('description')->getValue(); ?> </td>
                <td>
                    <div class="row-fluid">
                        <?php
                        echo $control->getAjaxLink(array('name' => '修改', 'id' => 'showAddWePoll'), array(
                            'cooker'=>'BWeEventWePollCooker\showAddWePoll',
                            'pollId' => $pollId, 
                            'eventId' => $eventId));
                        echo ' | ';
                        echo $control->getAjaxLink(array('name'=>'管理题目','id'=>'showWePollItemList'),array(
                            'cooker'=>'BWeEventWePollCooker\showWePollItemList',
                            'pollId'=>$pollId,
                            'eventId'=>$eventId                            
                        ));
                        ?>
                    </div>                   
                </td>
            </tr>
        <?php } ?>
    </tbody>
</table>
<?php
echo $control->getAjaxLink(array('name' => '添加投票', 'id' => 'showAddWePoll'), array(
    'cooker' => 'BWeEventWePoll\showAddWePoll',
    'eventId' => $eventId,
    'pollId' => 0,
    'htmlOptions' => array('class' => 'btn')
));
?>
